import request from "../config/request.js";
import host from "../config/host";

// 我的工单查询
const getWorkSheetQueryUserSubmit = function(params, callback) {
  request.postData(
    host.pcHostUrl + "/wx/workSheet/queryUserSubmit",
    params,
    callback
  );
};
const getWorkSheetQueryUserLeader = function(params, callback) {
  request.postData(
    host.pcHostUrl + "/wx/workSheet/queryUserLeader",
    params,
    callback
  );
};
const getWorkSheetQueryUserArea = function(params, callback) {
  request.postData(
    host.pcHostUrl + "/wx/workSheet/queryServiceArea",
    params,
    callback
  );
};
const getWorkSheetServiceAreaGraph = function(params, callback) {
  request.postData(
    host.pcHostUrl + "/wx/workSheet/serviceAreaGraph",
    params,
    callback
  );
};

const getWorkSheetDetail = function(params, success, error) {
  request.defaults({
    method: "post",
    url: host.pcHostUrl + "/wx/workSheet/detail",
    params,
    success,
    error
  });
};
const getWorkSheetHandleList = function(params, success) {
  request.defaults({
    method: "post",
    url: host.pcHostUrl + "/wx/workSheet/workSheetHandleList",
    params,
    success
  });
};
const getWorkSheetAccessComment = function(params, success,error) {
  request.defaults({
    method: "post",
    url: host.pcHostUrl + "/wx/workSheet/accessComment",
    params,
    success,
    error
  });
};
const postWorkSheetSaveComment = function(data, success) {
  request.defaults({
    method: "post",
    url: host.pcHostUrl + "/wx/workSheet/saveComment",
    data,
    success
  });
};
const getWorkSheetCommentsDetail = function(params, success) {
  request.defaults({
    method: "post",
    url: host.pcHostUrl + "/wx/workSheet/commentsDetail",
    params,
    success
  });
};
const postWorkSheetSaveWorkSheetHandle = function(data, success) {
  request.postData(
    host.pcHostUrl + "/wx/workSheet/saveWorkSheetHandle",
    data,
    success
  );
};
const postWorkSheetSaveWorkAdd = function(data, success) {
  request.postData(
    host.pcHostUrl + "/wx/workSheet/add",
    data,
    success
  );
};
const getLoadLeader = function(departmentId, callback) {
  request.getData(
    host.pcHostUrl + `/wx/user/loadLeader/${departmentId}`,
    callback
  );
};

export default {
  getWorkSheetQueryUserSubmit,
  getWorkSheetQueryUserLeader,
  getWorkSheetQueryUserArea,
  getWorkSheetServiceAreaGraph,
  getWorkSheetDetail,
  getWorkSheetHandleList,
  getWorkSheetAccessComment,
  postWorkSheetSaveComment,
  getWorkSheetCommentsDetail,
  postWorkSheetSaveWorkSheetHandle,
  postWorkSheetSaveWorkAdd,
  getLoadLeader,
};
